package builders;

import java.util.ArrayList;
import java.util.List;

import users.Person;
import books.BookInfo;
import books.BookRequestsInfo;
import books.BookReservation;

/**
 * BookRequestsInfo builder.
 */
public class BookRequestsInfoBuilder implements IBuilderExampler<BookRequestsInfo> {

    private BookInfo book;

    private BookReservation reservedTo;

    private List<Person> notificationList;

    public BookRequestsInfoBuilder() {
        this.notificationList = new ArrayList<Person>();
    }

    public BookInfo getBook() {
        return this.book;
    }

    public void setBook(final BookInfo book) {
        this.book = book;
    }

    public BookReservation getReservedTo() {
        return this.reservedTo;
    }

    public void setReservedTo(final BookReservation reservedTo) {
        this.reservedTo = reservedTo;
    }

    public List<Person> getNotificationList() {
        return this.notificationList;
    }

    public void setNotificationList(final List<Person> notificationList) {
        this.notificationList = notificationList;
    }

    public BookRequestsInfoBuilder withBookInfo(final BookInfo aBookInfo) {
        this.book = aBookInfo;
        return this;
    }

    public BookRequestsInfoBuilder andNotification(final Person person) {
        this.notificationList.add(person);
        return this;
    }

    public BookRequestsInfoBuilder withNotification(final Person person) {
        this.notificationList.add(person);
        return this;
    }

    public BookRequestsInfoBuilder withReservation(final BookReservation reservation) {
        this.reservedTo = reservation;
        return this;
    }

    @Override
    public BookRequestsInfo build() {
        return new BookRequestsInfo(this);
    }

    @Override
    public BookRequestsInfo example() {
        return new BookRequestsInfoBuilder().withBookInfo(new BookInfoBuilder().example())
                .withReservation(new BookReservationBuilder().example())
                .withNotification(new PersonBuilder().example()).build();
    }

}
